package com.snts.synchronization.utils;

import java.util.HashMap;
import com.snts.synchronization.core.BaseTable;

public class QueryHelper {

	private HashMap<String, String> tableAliases = new HashMap<String, String>();
	private int num = 0;	
	
	public String getTableAlias(BaseTable joinTable){
		String schema = joinTable.getSchema(); 
		String tableName = joinTable.getName();			
		String alias = tableAliases.get(schema + "_" + tableName);
		if(alias == null){
			alias = "t" + (++num);
			tableAliases.put(schema + "_" + tableName, alias);
		}
		return alias;
	}

}
